import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";

@Entity("charge_strategy", { schema: "cabinet" })
export class ChargeStrategy {
  @PrimaryGeneratedColumn({ type: "int", name: "strategy_id", unsigned: true })
  strategyId: number;

  @Column("int", { name: "merchant_id", unsigned: true, default: () => "'0'" })
  merchantId: number;

  @Column("varchar", { name: "strategy_name", comment: "策略名", length: 30 })
  strategyName: string;

  @Column("tinyint", {
    name: "strategy_type",
    comment: "类型",
    default: () => "'0'",
  })
  strategyType: number;

  @Column("decimal", {
    name: "unit_price",
    comment: "单价",
    precision: 4,
    scale: 2,
    default: () => "'0.00'",
  })
  unitPrice: string;

  @Column("float", {
    name: "settle_unit",
    comment: "最小计费单位",
    unsigned: true,
    precision: 12,
    default: () => "'0'",
  })
  settleUnit: number;

  @Column("smallint", {
    name: "max_power",
    comment: "最大功率",
    unsigned: true,
    default: () => "'0'",
  })
  maxPower: number;

  @Column("smallint", {
    name: "min_power",
    comment: "最小功率",
    unsigned: true,
    default: () => "'0'",
  })
  minPower: number;

  @Column("decimal", {
    name: "card_charge_amount",
    comment: "刷卡预付费",
    precision: 5,
    scale: 2,
    default: () => "'0.00'",
  })
  cardChargeAmount: string;

  @Column("varchar", { name: "remark", comment: "备注", length: 100 })
  remark: string;

  @Column("json", { name: "rules", nullable: true, comment: "费率规则" })
  rules: object | null;

  @Column("json", { name: "options", nullable: true, comment: "选项" })
  options: object | null;

  @Column("tinyint", {
    name: "full_stop",
    nullable: true,
    comment: "是否充满自停",
    width: 1,
    default: () => "'1'",
  })
  fullStop: boolean | null;

  @Column("tinyint", {
    name: "emerg_charge",
    nullable: true,
    comment: "是否可应急充电",
    width: 1,
    default: () => "'0'",
  })
  emergCharge: boolean | null;

  @Column("tinyint", {
    name: "emerg_count",
    comment: "应急充电次数",
    unsigned: true,
    default: () => "'0'",
  })
  emergCount: number;

  @Column("tinyint", {
    name: "emerg_energy",
    comment: "应急充电电能",
    unsigned: true,
    default: () => "'0'",
  })
  emergEnergy: number;

  @Column("tinyint", {
    name: "full_power",
    comment: "充满临界功率 W",
    unsigned: true,
    default: () => "'25'",
  })
  fullPower: number;

  @Column("tinyint", {
    name: "full_delay",
    comment: "判满延时 分钟",
    unsigned: true,
    default: () => "'10'",
  })
  fullDelay: number;

  @Column("tinyint", {
    name: "plug_off_dly",
    comment: "拔掉停止延时 秒",
    unsigned: true,
    default: () => "'60'",
  })
  plugOffDly: number;

  @Column("smallint", {
    name: "free_occupy_time",
    comment: "免费占位时长 分钟",
    unsigned: true,
    default: () => "'0'",
  })
  freeOccupyTime: number;

  @Column("decimal", {
    name: "occupy_price",
    comment: "占位收费 小时",
    precision: 5,
    scale: 2,
    default: () => "'0.00'",
  })
  occupyPrice: string;

  @Column("json", {
    name: "integrated",
    nullable: true,
    comment: "继承后的数据",
  })
  integrated: object | null;

  @Column("int", {
    name: "update_time",
    comment: "更新",
    unsigned: true,
    default: () => "'0'",
  })
  updateTime: number;

  @Column("int", {
    name: "create_time",
    comment: "创建时间",
    unsigned: true,
    default: () => "'0'",
  })
  createTime: number;
}
